<template>
    <div class="LW_workOut_div">
        <div class="LW_workOnline_top" style="background: #059EDF 100%">
            <div class="LW_workOnline_top_ico_div" @click="$router.push('/lineWork')">
                <a-icon type="arrow-left" class="LW_workOnline_top_ico" theme="outlined" />
            </div>
            <div class="LW_workOnline_top_menu">作业出场</div>
        </div>
        <div class="LW_workOnline_content" >
            <a-row type="flex" justify="center" align="middle" >
                <a-col :span="24" >
                    <div class="LW_workInto_circle" @click="sendStep()">出场</div>
                </a-col>
            </a-row>
        </div>
    </div>
</template>
<style >
    .LW_workOut_div{
        width: 100vw;
    }

</style>
<script>
    import ACol from "ant-design-vue/es/grid/Col";
    import ARow from "ant-design-vue/es/grid/Row";
    export default {
        name: "LineWorkOut",
        components: {ARow, ACol},
        data() {
            return {
                myStep:'8',
                name:'作业出场',
                id:'',
            }
        },
        methods:{
            sendStep(){
                let that = this;
                let methodName = "开始";
                let note = '';
                let lineOrderName = "作业工单";
                let lineOrderMethodName = "跳过";
                let currStepInfo ={};
                that.id =that.$route.params.id?that.$route.params.id:JSON.parse(localStorage.getItem("currStepInfo")).id;//路由参数计划编号
                //这里缺少作业工单一步 后端有这个步骤才能完成作业计划，这里前端处理可以保留作业工单接口
                that.$api.step(that.id,lineOrderName,lineOrderMethodName,note).then((resp)=>{
                    if(resp.status === 200){
                        //let otherFailSendInfo = failSendInfo.filter(item=>item.UserId!==UserId);//其余的失败信息集合*/
                        console.log("作业工单进行跳过，衔接作业出场");
                    }
                }).catch((error)=>{
                    alert("作业工单跳过失败");
                    console.log(error);
                });

                that.$api.step(that.id,that.name,methodName,note).then((resp)=>{
                    if(resp.status === 200){
                        //let otherFailSendInfo = failSendInfo.filter(item=>item.UserId!==UserId);//其余的失败信息集合*/
                        console.log(that.name+"计划开始成功");

                        currStepInfo.step = that.myStep;
                        currStepInfo.id = that.id;
                        currStepInfo.name = that.name;
                        localStorage.setItem("currStepInfo",JSON.stringify(currStepInfo));

                        that.$router.push({name: 'lineWorkTakePhoto',params: {step: that.myStep,id:that.id,name:that.name}})
                    }
                }).catch((error)=>{
                    alert("计划开始失败");
                    console.log(error);
                })

            },
        },
    }
</script>

